package in.freshstart.java.training.arrays;

public class SortArrayTest {
	public static void main(String[] args) {
		int[] a = { 1, 7, 3, 4, 5, 6 };
		System.out.println("Array before sort");
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + "\t");
		}
		System.out.println();
		/**
		 * Below code calls Bubble sort Methos and it will use bubble sort
		 * technique
		 */

		ArrayExerBubbleSort o1 = new ArrayExerBubbleSort();
		int[] b = o1.bubbleSort(a);
		int k = b.length;
		System.out.println("array after bubble sort");
		for (int i = 0; i < k; i++) {
			System.out.print(b[i] + "\t");
		}
		System.out.println();

		/**
		 * Below code calls Quick sort Methos and it will use Quick sort
		 * technique
		 */
		ArrayExerQuickSort o2 = new ArrayExerQuickSort();
		int[] c = o2.quickSort(a, 0, a.length - 1);
		System.out.print("array after quick sorting \n");
		for (int i = 0; i < c.length; i++) {
			System.out.print(c[i] + "\t");
		}

		/**
		 * Below code calls Merge sort Method and it will use Merge sort
		 * technique
		 */
		System.out.println();
		System.out.println("Array elements after Merge Sort");

		ArrayExerMergeSort o3 = new ArrayExerMergeSort();
		int[] d = o3.mergeSort(a, 0, a.length - 1);
		for (int i = 0; i < d.length; i++) {
			System.out.print(d[i] + "\t");
		}

		/**
		 * Below code calls Heap sort Method and it will use Heap sort technique
		 */
//		System.out.println();
//		System.out.println("Array elements after Heap Sort");
//		int[] e={};
//
//		ArrayExerHeapSort o4 = new ArrayExerHeapSort();
//		 for(int z=a.length; z>1; z--){
//		      
//		   		 e = o4.heapSort(a, a.length - 1);
//		 }
//		for (int j = 0; j < e.length; j++) {
//			System.out.print(e[j] + "\t");
//		}
		System.out.println();
		System.out.println("Array elements after Insertion Sort");
		ArrayExerInsertionSort o5=new ArrayExerInsertionSort();
		int[] f=o5.insertionSort(a,a.length);
		
		for (int j = 0; j < f.length; j++) {
			System.out.print(f[j] + "\t");
		}
		
		System.out.println();
		System.out.println("Array elements after Selection Sort");
        ArrayExerSelectionSort o6=new ArrayExerSelectionSort();
        int[] g=o6.selection_srt(a,a.length);
        for (int j = 0; j < g.length; j++) {
			System.out.print(g[j] + "\t");
		}
        
	}
}
